/**
 * Create in 2012-4-25.
 */
package kit4j.tests.jdk.swing;

import java.util.concurrent.TimeUnit;

import javax.swing.JSpinner;
import javax.swing.JSpinner.DefaultEditor;
import javax.swing.SpinnerDateModel;

import org.junit.Test;

/**
 * 
 * @author MiniKnife
 *
 */
public class TestJSpinner {

	@Test
	public void testShowDefaultJSpinner() throws InterruptedException {
		JSpinner spinner = new JSpinner();
		
		SwingUtil.showComponent(spinner);
	}
	
	@Test
	public void testShowJSpinnerWithDate() throws InterruptedException {
		JSpinner spinner = new JSpinner(new SpinnerDateModel());
		Object editor = spinner.getEditor();

		if(editor instanceof DefaultEditor) {
			((DefaultEditor)editor).getTextField().setEditable(false);
		}
		
		SwingUtil.showComponent(spinner);
		TimeUnit.SECONDS.sleep(10);
	}
}
